<?php

namespace App\Admin\Controllers;


use App\Models\GoodsType;
use App\Models\StoreGood;
use Dcat\Admin\Grid;
use Dcat\Admin\Grid\LazyRenderable;

class UserTable extends LazyRenderable
{
    public function grid(): Grid
    {
        return Grid::make(new StoreGood(), function (Grid $grid) {
            $grid->column('store_name','商品名称');
            $grid->column('price','商品价格');
            $grid->column('stock','商品库存');
//            $grid->column('cate_id')->display(function ($e){
//                $data=GoodsType::where('cate_id',$this->cate_id)->pluck('type_name');
//                return $data[0];
//            });
            $grid->column('created_at');
            $grid->column('updated_at');
        });
    }
}
